package view;

//import com.cloudgarden.layout.AnchorConstraint;
//import com.cloudgarden.layout.AnchorLayout;
//import com.jgoodies.forms.layout.CellConstraints;
//import com.jgoodies.forms.layout.FormLayout;

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;

import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import model.ModeloServidorCorreo;

import com.sun.org.apache.xalan.internal.xsltc.dom.AbsoluteIterator;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class FrameMain extends javax.swing.JFrame implements ActionListener{
	private JPanel jPanelMain;
	private JButton jButtonOrdenesDeCompra;
	private JButton jButtonMatImportado;

	private static ModeloServidorCorreo modelo;
	
//	private FrameMatNacional frameMatNacional;
//	private FrameMatImportado frameMatImportado;
//	private FrameOrdenDeCompra frameOrdenDeCompra;
	private FrameCasilla frameCasillas;
//	private FrameAutomobil frameAutomobil;
//	private FrameOrdenProduccion frameOrdenProduccion;
	private JButton jButtonCasillas;
	private JButton jButtonOrdenDeProduccion;
	private JButton jButtonDespachos;
	private JButton jButtonMatNacional;
	private JButton jButtonAutomobiles;
	
	private static final FrameMain INSTANCE = new FrameMain();
	
	private FrameMain(){super();}
	
	public static FrameMain getInstancia(){
		return INSTANCE;
	}

	public void init(ModeloServidorCorreo modelo) {
		this.modelo = modelo;
		this.setLocationRelativeTo(null);
		this.setVisible(true);
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				this.setTitle("Empresa Automotor");
				jPanelMain = new JPanel();
				GridBagLayout jPanelMainLayout = new GridBagLayout();
				jPanelMainLayout.rowWeights = new double[] {0.1, 0.1, 0.1};
				jPanelMainLayout.rowHeights = new int[] {7, 7, 7};
				jPanelMainLayout.columnWeights = new double[] {0.1, 0.1, 0.1};
				jPanelMainLayout.columnWidths = new int[] {7, 7, 7};
				getContentPane().add(jPanelMain, BorderLayout.CENTER);
				jPanelMain.setLayout(jPanelMainLayout);
				jPanelMain.setPreferredSize(new java.awt.Dimension(662, 266));
				{
					jButtonMatNacional = new JButton();
					jPanelMain.add(jButtonMatNacional, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
					String lbl = "<html>" + "Materiales" + "<br>" + "Nacionales" + "</html>";
					jButtonMatNacional.setText(lbl);
					jButtonMatNacional.setPreferredSize(new java.awt.Dimension(392, 21));
					jButtonMatNacional.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							System.out.println("jButtonMatNacional.actionPerformed, event="+evt);
//							frameMatNacional = FrameMatNacional.getInstancia();
//							frameMatNacional.init(modelo);
//							frameMatNacional.setLocationRelativeTo(null);
//							frameMatNacional.setVisible(true);
						}
					});
				}
				{
					jButtonMatImportado = new JButton();
					jPanelMain.add(jButtonMatImportado, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
					String lbl = "<html>" + "Materiales" + "<br>" + "Importados" + "</html>";
					jButtonMatImportado.setText(lbl);
					jButtonMatImportado.setPreferredSize(new java.awt.Dimension(121, 224));
					jButtonMatImportado.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							System.out.println("jButtonMatImportado.actionPerformed, event="+evt);
//							frameMatImportado = FrameMatImportado.getInstancia();
//							frameMatImportado.init(modelo);
//							frameMatImportado.setLocationRelativeTo(null);
//							frameMatImportado.setVisible(true);
						}
					});
				}
				{
					jButtonOrdenesDeCompra = new JButton();
					jPanelMain.add(jButtonOrdenesDeCompra, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
					String lbl = "<html>" + "Ordenes de" + "<br>" + "Compra" + "</html>";
					jButtonOrdenesDeCompra.setText(lbl);
					jButtonOrdenesDeCompra.setPreferredSize(new java.awt.Dimension(105, 224));
					jButtonOrdenesDeCompra.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							System.out.println("jButtonOrdenesDeCompra.actionPerformed, event="+evt);
//							frameOrdenDeCompra = FrameOrdenDeCompra.getInstancia();
//							frameOrdenDeCompra.init(modelo);
//							frameOrdenDeCompra.setLocationRelativeTo(null);
//							frameOrdenDeCompra.setVisible(true);
						}
					});
				}
				{
					jButtonDespachos = new JButton();
					jPanelMain.add(jButtonDespachos, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
					String lbl = "<html>" + "Despachos de" + "<br>" + "Fabricacion" + "</html>";
					jButtonDespachos.setText(lbl);
					jButtonDespachos.setPreferredSize(new java.awt.Dimension(138, 21));
					jButtonDespachos.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							System.out.println("jButtonDespachos.actionPerformed, event="+evt);
//							frameDespachoFabricacion = FrameDespachoFabricacion.getInstancia();
//							frameDespachoFabricacion.init(modelo);
//							frameDespachoFabricacion.setLocationRelativeTo(null);
//							frameDespachoFabricacion.setVisible(true);
						}
					});
				}
				{
					jButtonCasillas = new JButton();
					jPanelMain.add(jButtonCasillas, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
					String lbl = "<html>" + "Casillas de" + "<br>" + "Correo" + "</html>";
					jButtonCasillas.setText(lbl);
					jButtonCasillas.setPreferredSize(new java.awt.Dimension(392, 21));
					jButtonCasillas.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							System.out.println("jButtonProveedores.actionPerformed, event="+evt);
							frameCasillas = FrameCasilla.getInstancia();
							frameCasillas.init(modelo);
							frameCasillas.setLocationRelativeTo(null);
							frameCasillas.setVisible(true);
						}
					});
				}
				{
					jButtonAutomobiles = new JButton();
					jPanelMain.add(jButtonAutomobiles, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
					jButtonAutomobiles.setText("Automobiles");
					jButtonAutomobiles.setPreferredSize(new java.awt.Dimension(166, 224));
					jButtonAutomobiles.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							System.out.println("jButtonAutomobiles.actionPerformed, event="+evt);
//							frameAutomobil = FrameAutomobil.getInstancia();
//							frameAutomobil.init(modelo);
//							frameAutomobil.setLocationRelativeTo(null);
//							frameAutomobil.setVisible(true);
						}
					});
				}
				{
					jButtonOrdenDeProduccion = new JButton();
					jPanelMain.add(jButtonOrdenDeProduccion, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
					String lbl = "<html>" + "Ordenes de" + "<br>" + "Produccion" + "</html>";
					jButtonOrdenDeProduccion.setText(lbl);
					jButtonOrdenDeProduccion.setPreferredSize(new java.awt.Dimension(125, 21));
					jButtonOrdenDeProduccion.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							System.out.println("jButtonOrdenDeProduccion.actionPerformed, event="+evt);
//							frameOrdenProduccion = FrameOrdenProduccion.getInstancia();
//							frameOrdenProduccion.init(modelo);
//							frameOrdenProduccion.setLocationRelativeTo(null);
//							frameOrdenProduccion.setVisible(true);
						}
					});
				}

			}
			pack();
			setSize(400, 300);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
		
	}


}
